/**
 * 表单渲染器
 */
import {BaseRender} from "./base-render.ts"
import {StyleValue} from "vue";

/**
 * 组件
 */
import {
    ElCascader,
    ElCheckbox,
    ElCheckboxGroup,
    ElColorPicker,
    ElDatePicker,
    ElInput,
    ElInputNumber,
    ElInputTag,
    ElRadio,
    ElRadioGroup,
    ElRate,
    ElSelect,
    ElSlider,
    ElSwitch,
    ElTimePicker,
    ElUpload
} from "../components/element/index.ts";
import {YyImage, YyImageForm, YyImgUpload,} from "../components/yy/index.ts";

/**
 * 功能组件
 */
type FormComponents<Prop> =
    ElInput<Prop>
    | ElSelect<Prop>
    | ElDatePicker<Prop>
    | ElInputNumber<Prop>
    | ElUpload<Prop>
    | ElCheckboxGroup<Prop>
    | ElCheckbox<Prop>
    | ElCascader<Prop>
    | ElInputTag<Prop>
    | ElTimePicker<Prop>
    | ElSwitch<Prop>
    | ElSlider<Prop>
    | ElRate<Prop>
    | ElColorPicker<Prop>
    | ElRadioGroup<Prop>
    | ElRadio<Prop>
    | YyImage<Prop>
    | YyImageForm<Prop>
    | YyImgUpload<Prop>

/**
 * 表单组件基础接口
 */
export interface FormRender<EType, Prop, Props, Events> extends BaseRender<Prop> {
    eType: EType
    prop?: keyof Prop
    props?: Partial<Props>
    events?: Partial<Events>
    style?: Partial<StyleValue>
    isShow?: (data?: Prop) => boolean
    isDisable?: (data?: Prop) => boolean
    tabName?: string
    sectionName?: string
    span?: number
}

/**
 * 功能组件列表
 */
export type FormEls<Prop> = FormComponents<Prop> | BaseRender<Prop>

